package com.qinghuan.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint;
import org.springframework.stereotype.Component;

/**
 * @Auther: qinghuan
 * @Date: 2022/3/5 22:17
 * @Description:
 */

@Aspect
@Component
public class LoggerAspect {

    @Around(value = "execution(* com.qinghuan.service.ProductService.*(..))")
    public Object log(ProceedingJoinPoint joinPoint) throws Throwable {
        System.out.println("start log" + joinPoint.getSignature().getName());
        Object object = joinPoint.proceed();
        System.out.println("end log" + joinPoint.getSignature().getName());

        return object;
    }

}
